package cn.itcast.java;

/**
 * Author itcast
 * Date 2021/10/13 11:39
 * Desc TODO
 */
public class AnimalTest {
    public static void main(String[] args) {
        //todo 1 匿名内部类实现 eat
        /*print(new Animal() {
            @Override
            public void eat() {
                System.out.println("猫吃鱼！");
            }
        });*/
        //todo 2 lambda 表达式实现 eat
        // (参数列表) -> { 实现逻辑 }
        print((String food) -> {
            System.out.println("狗吃" + food);
        });
    }

    public static void print(Animal an) {
        an.eat("狗粮");
    }
}
